﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Newtonsoft.Json;


/// <summary>
///StockCode 的摘要说明
/// </summary>
public static class Stocks
{

    public static List<StockEnty> GetStock()
    {
        List<StockEnty> list = new List<StockEnty>();
        try
        {
            string key = "stocks";
            if (System.Web.HttpContext.Current.Cache[key] != null)
            {
                list = (List<StockEnty>)System.Web.HttpContext.Current.Cache[key];
            }
            else
            {
                Basic b = new Basic();
                list = JsonConvert.DeserializeObject<List<StockEnty>>(Pub.LoadData(b.jsonUrl + "stock/HashStock.ashx"));

                System.Web.HttpContext.Current.Cache.Add(key, list, null, DateTime.Now.AddHours(3), TimeSpan.Zero, System.Web.Caching.CacheItemPriority.Default, null);
            }
        }
        catch { }
        return list;
    }
}

public class StockEnty
{
    public string stock { get; set; }

    public string name { get; set; }
}
